package cn.edu.tju.fctl.util;

import cn.edu.tju.fctl.entities.LeaveInfo;

/**
 * Created by catold on 15/12/22.
 */
public class VacationStatusUtil {
    /**
     * 判断当前info状态是否可以改变为vacationStatus
     * @param leaveInfo 当前假期
     * @param vacationStatus 下一个状态
     * @return
     */
    public static boolean canStatusChange(final LeaveInfo leaveInfo, final VacationStatus vacationStatus){
        VacationStatus curstatus = VacationStatus.valueOf(leaveInfo.getStatus());
        return vacationStatus.getAllowPreStatusList().contains(curstatus);
    }

    /**
     * 判断当前info状态是否可以改变为vacationStatus
     * @param leaveInfo 当前假期
     * @param vacationStatus 下一个状态
     * @return
     */
    public static boolean canStatusChange(final LeaveInfo leaveInfo, final String vacationStatus){
        VacationStatus curstatus = VacationStatus.valueOf(leaveInfo.getStatus());
        VacationStatus nextstatus = VacationStatus.valueOf(vacationStatus);
        return nextstatus.getAllowPreStatusList().contains(curstatus);
    }
}
